package com.biz.primus.ms.payment.dao.po;

import com.biz.primus.base.enums.CommonStatus;
import com.biz.primus.model.payment.enums.PaymentTradeType;
import com.biz.primus.model.payment.enums.PaymentType;
import com.biz.primus.ms.base.jpa.po.BaseEntity;
import javax.persistence.*;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

@Entity
@Table(name = "payment_channel")
@Data
public class PaymentChannel extends BaseEntity {

    private static final long serialVersionUID = 3031876100800305128L;

    /**
     * 渠道类型
     */
    private PaymentType paymentType;

    /**
     * 交易类型
     */
    private PaymentTradeType paymentTradeType;

    /**
     * 商户
     */
    @ManyToOne(fetch = FetchType.LAZY)
    private Merchant merchant;

    /**
     * 支付渠道状态
     */
    @Column
    @Convert(converter = CommonStatus.Converter.class)
    private CommonStatus status;

    /**
     * 配置参数,json字符串
     */
    private String param;

    /**
     * 备注
     */
    private String remark;

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
    }
}